#ifndef PREF_INPUT_H_
#define PREF_INPUT_H_

#include "../widgets.h"
#include "p_widgets.h"

namespace gpyp {
namespace pref {

class Input : public Gtk::VBox {
private:
  class Selector : public SelectorComboBox<ConfInput::RefInputEntry> {
  public:
    Selector(Application &app);
  };

  class KeyList : public ListView<KeyBind> {
  private:
#ifdef GTK_HAVE_CELL_RENDERER_ACCEL
    Gtk::CellRendererAccel renderer_accel_;
#else
    CellRendererAccel      renderer_accel_;
#endif
    Gtk::CellRendererText  renderer_command_;

    Gtk::TreeViewColumn    column_accel_;
    Gtk::TreeViewColumn    column_command_;

  protected:
    void accel_on_cell_data(Gtk::CellRenderer *cell,
                            const Gtk::TreeIter &iter);
    void accel_on_accel_edited(const Glib::ustring &path_string,
                               guint accel_key,
                               Gdk::ModifierType accel_mods,
                               guint hardware_keycode);
    void command_on_cell_data(Gtk::CellRenderer *cell,
                              const Gtk::TreeIter &iter);
    void command_on_edited(const Glib::ustring &path,
                           const Glib::ustring &new_text);

  public:
    void set(RefKeyBind keybind);

    KeyList();
  };

  Application      &app_;

  Selector          selector_;
  Gtk::Frame        mouse_;
  Gtk::Entry        mouse_double_click_;
  Gtk::Entry        mouse_button2_;
  Gtk::Entry        mouse_button6_;
  Gtk::Entry        mouse_button7_;
  Gtk::Entry        mouse_button8_;
  Gtk::Entry        mouse_button9_;
  Gtk::ComboBoxText mouse_ex_selector_;
  Gtk::Entry        mouse_ex_;
  Gtk::Frame        key_;
  KeyList           key_list_;

  ConfInput::RefInputEntry selected_;
  ConfMain::RefCommand     selected_ex_;

  void reset_button_command();

public:
  void set(ConfInput::RefInputEntry input);

  Input(Application &app, Gtk::Window &parent);
};

}/*pref*/
}/*gpyp*/

#endif/*PREF_INPUT_H_*/
